#ifndef GO2DWIDGET_H
#define GO2DWIDGET_H

#include <QGLWidget>
#include "AbstractBoard.h"

class Go2DWidget: public QGLWidget
{
    Q_OBJECT

    public:
        Go2DWidget(QWidget *parent = 0);
        void undo();

    protected:
        void initializeGL();
        void paintGL();
        void resizeGL(int w, int h);
        void mouseMoveEvent(QMouseEvent *event);
        void mouseReleaseEvent(QMouseEvent *event);

    private:
        GLuint tex_black, tex_white;
        void drawBoard();
        void drawStone(int x_coord, int y_coord, bool ghost);
        void drawGhostStone();
        void drawPlayZones();
        int *getBoardCoord(GLdouble x, GLdouble y);
        void drawDisk(GLdouble radius);
        void drawHoshi();
        void drawPlayedStones();
        GLdouble *untransformCoords(int event_x, int event_y);
        GLdouble xPos_cursor, yPos_cursor;
        int width, height;
        AbstractBoard *board;
        int turn;
        void loadTextures();
        void drawOverlay();
        void drawSquare(double x, double y, double l);
};

#endif
